<!DOCTYPE html>
<html class="no-js">

<head>
	<meta charset="utf-8">
	<title>{BEESCRM:$title}</title>
	<meta name="description" content="">
	<meta name="HandheldFriendly" content="True">
	<meta name="MobileOptimized" content="320">
	<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui, user-scalable=no">
	<meta http-equiv="cleartype" content="on">
	<meta name="format-detection" content="telephone=no">

	<link rel="stylesheet" type="text/css" href="/assets/base/lost/css/common.css?v={BEESCRM:$time}">
	<link rel="stylesheet" type="text/css" href="/assets/base/lost/css/index.css?v={BEESCRM:$time}">
	<link rel="stylesheet" type="text/css" href="/assets/base/lost/css/font.css?v={BEESCRM:$time}">
	<link rel="stylesheet" href="/assets/bower_components/sweetalert/lib/sweet-alert.css?v={BEESCRM:$time}">
</head>
<body>
<div class="wraper center">
	<div class="head">
		<a href="javascript:history.go(-1);" class="iconfont icon-fanhui72"></a>
		<a href="/base/lost/center/lost_id/{BEESCRM:$lostId}" class="head-name">失物详情</a>
	</div>
	<p class="field">物品名称</p>
	<div class="form-list tb-mode">
		<p class="tb-cell">{BEESCRM:$data.info_name}<span class="status">{BEESCRM:$data.type_name}</span></p>
	</div>
	<div class="dialog">
		<span class="left-big"></span>
		<span class="left-middle"></span>
		<p><span>拾获地点：</span>{BEESCRM:$data.find_address}</p>
		<p><span>详情描述：</span>{BEESCRM:$data.info_desc}</p>
		<div class="detail-img"><img src="{BEESCRM:$data.img_url}"/></div>
		<p><span>领取地点：</span>{BEESCRM:$data.address}</p>
		<p><span>联系电话：</span>{BEESCRM:$data.address_mobile}<span class="pull-right"><if condition="$data['get_time']">{BEESCRM:$data.get_time|date="Y-m-d",###}</if></span></p>
		<if condition="$data['status'] eq 1">
			<p class="yrling"><img src="/assets/base/lost/images/yrling.png"/></p>
		</if>

		<if condition="$data['status'] eq 3">
			<p class="yrling"><img src="/assets/base/lost/images/line.png"/></p>
		</if>
	</div>
	<div class="dialog">
		<span class="left-big"></span>
		<span class="left-middle"></span>
		<p class="text-center">有 <span class="person-num">{BEESCRM:$userCount}</span> 人申请认领该物品</p>
	</div>
	<if condition="($data['status'] eq 0) && ($flag eq 1)">
	<div class="btn-box">
		<a href="javascript:void(0);" class="btn get" data-id="{BEESCRM:$data.info_id}">我要认领</a>
	</div>
		</if>
	<div class="bottom-box">
		<p class="copyright">杭州青橄榄网络技术有限公司 技术支持</p>
	</div>
</div>
<script src="/assets/base/lost/js/jquery-2.1.0.min.js"></script>
<script src="/assets/base/lost/js/jq.utils.js"></script>
<script src="/assets/bower_components/sweetalert/lib/sweet-alert.min.js"></script>
<script>
	$(function(){
		var height = $(window).height();
		var bottombox_height = $('.bottom-box').outerHeight();
		$('.wraper').css("minHeight",height);
		$('.wraper').css("paddingBottom",bottombox_height);

		$('.get').on('click',function(){
			var id = $(this).data('id');
			if(id){
				$.confirm('温馨提示：确定认领吗？', drop);
				function drop() {
					var json = {};
					var data = {};
					data.id = id;
					json.data = data;
					json.url = '/base/lost/get/lost_id/{BEESCRM:$lostId}';
					json.method = 'post';
					json.type = 'json';
					$.getAjax(json, true, reload, '');
				}
			}
		});

		// 页面刷新
		function reload(){
			setTimeout('location.reload()',2000);
		}
	})
	// 下面这个函数用来转换数组到json格式
    function arrayToJson(o) {
        var r = [];
        if (typeof o == "string") return "\"" + o.replace(/([\'\"\\])/g, "\\$1").replace(/(\n)/g, "\\n").replace(/(\r)/g, "\\r").replace(/(\t)/g, "\\t") + "\"";
        if (typeof o == "object") {
            if (!o.sort) {
                for (var i in o)
                    r.push(i + ":" + arrayToJson(o[i]));
                if (!!document.all && !/^\n?function\s*toString\(\)\s*\{\n?\s*\[native code\]\n?\s*\}\n?\s*$/.test(o.toString)) {
                    r.push("toString:" + o.toString.toString());
                }
                r = "{" + r.join() + "}";
            } else {
                for (var i = 0; i < o.length; i++) {
                    r.push(arrayToJson(o[i]));
                }
                r = "[" + r.join() + "]";
            }
            return r;
        }
        return o.toString();
    }
	//这个是调用微信图片浏览器的函数
    function imagePreview(curSrc,srcList) {
        //这个检测是否参数为空
        if(!curSrc || !srcList || srcList.length == 0) {
            return;
        }
        //这个使用了微信浏览器提供的JsAPI 调用微信图片浏览器
        WeixinJSBridge.invoke('imagePreview', {
            'current' : curSrc,
            'urls' : srcList
        });
    };

    (function($){
        //下面是获取当前页面所有的img的src 转成数组 并且 转换成json格式
        var aa=[];
        var i=0;
        var src=[];
        var json=null;
        aa=$('img');
        for (i=0;i<aa.length;i++){
            src[i]=aa[i].src;    //把所有的src存到数组里
        }
        var srcList=arrayToJson(src); //转换成json并赋值给srcList
        //下面是点击图片的时候获取当前第几个图片并且启用咱们做的调用微信图片浏览器的函数
        $('img').click(function(){
            var index = $('img').index(this);
            imagePreview(src[index],src);
        });

    })(jQuery);
</script>
</body>
</html>
